<template>
  <div id="footprint">
    <c-title :hide="false"
             text='我的足迹'></c-title>
    <div class="collection-title flex-a-c flex-j-sb">
      <div>我的足迹</div>
      <div class="operate" @click="operateOn">{{checkAll?'完成':'管理'}}</div>
    </div>
    <div class="coll-48"></div>
      <div class="footprint-list" v-if="datas.length > 0">
        <block v-for="(item,index) in datas" :key="index">
          <div class="footprint-item">
            <div class="flex-a-c footprint-title">
              <van-checkbox v-model="item.checked" checked-color="#FE5E56" v-show="checkAll" @click="timeCheck(item.goodsList,item.checked)"></van-checkbox>
              <h3 :class="checkAll?'h3-p12':''">{{item.dataName}}</h3>
            </div>
            <div class="goods-list flex">
              <div 
                class="goods-item" 
                v-for="(goodsItem,goodsIndex) in (item.goodsList)" 
                :key="goodsIndex"
                @touchstart="gtouchstart(goodsItem)"
                @touchmove="gtouchmove()"
                @touchend.stop="showDeleteButton(goodsItem)">
                <img :src="goodsItem.thumb" />
                <div class="item-wrap">
                  <p class="title pl">{{goodsItem.title}}</p>
                  <template v-if="goodsItem && goodsItem.point_goods">
                    <p class="price">
                      <span>{{ goodsItem.point_goods.min_point }}</span>{{integral}}
                    </p>
                  </template>
                  <template v-else>
                    <p class="price"  v-if="goodsItem.vip_level_status&&goodsItem.vip_level_status.status==1"> {{goodsItem.vip_level_status.word}}</p>
                    <p class="price"  v-else-if="goodsItem.has_option">¥{{goodsItem.option_price?goodsItem.option_price:goodsItem.price}}</p>
                    <p class="price"  v-else>¥{{goodsItem.price}}</p>
                  </template>
                </div>
                <div class="goods-select" v-show="checkAll" @click.stop="goodsCheck(item,goodsItem)">
                  <div class="goods-checkbox">
                    <van-checkbox v-model="goodsItem.goodsChecked" checked-color="#FE5E56" ></van-checkbox>
                  </div>
                  
                </div>
                <div class="masking-del flex-a-c flex-j-c" :class="goodsItem.maskChecked?'masking-bg':''">
                  <div class="del-btn" @click.prevent="maskClick(goodsItem,index,goodsIndex)"  v-show="goodsItem.maskChecked">删除</div>
                </div>
              </div>
            </div>
          </div>
        </block>
      </div>

    <van-empty description="您还没有浏览过任何商品" v-else/>
    <div class="mh-56"></div>
    <div class="footer-btn flex-a-c flex-j-sb" v-show="checkAll">
      <div class="footer-checked">
        <van-checkbox v-model="collChecked" checked-color="#FE5E56" @click="allClick">全选</van-checkbox>
      </div>
      <div class="confrim-btn" @click="footListDel">删除</div>
    </div>
  </div>
</template>

<script>
import footprintcontroller from "./footprintcontroller";

export default footprintcontroller;
</script>
<style scoped>
  * {
    -webkit-touch-callout:none;
    -webkit-user-select:none; 
    -moz-user-select:none;
    -ms-user-select:none; 
    user-select:none;
  }
  #footprint ::v-deep .van-nav-bar--fixed {
    border-bottom: none;
  }
</style>
<style lang="scss" rel="stylesheet/scss" scoped>

  @keyframes warn {
    0% {
      transform: scale(0);
      background-color: rgba($color: #000000, $alpha: 0);
    }
    25% {
      transform: scale(0);
      background-color: rgba($color: #000000, $alpha: 0.1);
    }
    50% {
      transform: scale(0.1);
      background-color: rgba($color: #000000, $alpha: 0.2);
    }
    75% {
      transform: scale(0.5);
      background-color: rgba($color: #000000, $alpha: 0.3);
    }
    100% {
      transform: scale(1);
      background-color: rgba($color: #000000, $alpha: 0.5);
    }
  }

  @-webkit-keyframes warn {
    0% {
      -webkit-transform: scale(0);
      background-color: rgba($color: #000000, $alpha: 0);
    }
    25% {
      -webkit-transform: scale(0);
      background-color: rgba($color: #000000, $alpha: 0.1);
    }
    50% {
      -webkit-transform: scale(0.1);
      background-color: rgba($color: #000000, $alpha: 0.2);
    }
    75% {
      -webkit-transform: scale(0.5);
      background-color: rgba($color: #000000, $alpha: 0.3);
    }
    100% {
      -webkit-transform: scale(1);
      background-color: rgba($color: #000000, $alpha: 0.5);
    }
  }
  .pl {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .masking-bg {
    -webkit-animation: warn .1s ease-out;
    -moz-animation: warn .1s ease-out;
    animation: warn .1s ease-out;
    -webkit-animation-iteration-count: 1;
    -moz-animation-iteration-count: 1;
    animation-iteration-count: 1;
    background-color: rgba($color: #000000, $alpha: 0.5);
  }

  #appMain #footprint  .collection-title,#appMain #footprint  .footer-btn {
    left:auto;
  }
  .ell {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    /* 定义显示的行数 */
    overflow: hidden;
  }
  .footprint-title {
    padding: 0 0 0.9375rem 0;
  }
  .coll-48 {
    height: 3rem;
    clear: both;
  }
  #footprint {
    padding-bottom: 0.5rem;
    position: relative;
    .collection-title {
      position: fixed;
      top:2.3125rem;
      left:0;
      background-color: #fff;
      width:23.4375rem;
      height: 3rem;
      line-height: 3rem;
      // padding:1.0625rem 0.875rem;
      padding: 0 0 0 0.875rem;
      font-weight: 500;
      color: #00001C;
      font-size: 0.875rem;
      line-height: 0.875rem;
      z-index: 25;
    }
    .collection-title .operate {
      cursor: pointer;
      padding:0 0.875rem;
    }
    .pl {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .footprint-list {
      padding: 1.5625rem 0 0 0;
      margin:0 0.75rem;
      .footprint-item {
        padding:0 0 1.1875rem 0;
        h3 {
          font-size: 1rem;
          color: #00001C;
          line-height: 1.0625rem;
          text-align: left;
        }
        .h3-p12 {
          padding: 0 0 0 0.375rem;
        }
        .goods-list {
          flex-wrap: wrap;
          
          .goods-item {
            width:7.0625rem;
            border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
            background-color: #fff;
            margin:0 0.375rem 0.375rem 0;
            position: relative;
            cursor: pointer;
            &:nth-child(3n) {
              margin-right: 0;
            }
            .item-wrap {
              padding: 0.5625rem 0.625rem 0.625rem 0.5rem;
              .title,.price {
                text-align: left;
              }
              .title {
                font-size: 0.875rem;
                line-height: 0.875rem;
                font-weight: 500;
                color: #00001C;
                
              }
              .price {
                font-weight: bold;
                color: #F15353;
                padding:5px 0 0 0;
              }
            }
            
            img {
              border-radius: 0.5rem 0.5rem 0rem 0rem;
              width: 7.0625rem;
              height: 7.0625rem;
              margin:0;
              display: block;
            }
            .goods-select {
              position: absolute;
              width: 100%;
              height: 100%;
              top:0;
              left:0;
              // right: 5px;
              // top:5px;
              z-index: 22;
              .goods-checkbox {
                position: absolute;
                right: 0.3125rem;
                top:0.3125rem;
              }
            }
            .masking-del {
              width: 100%;
              height: 100%;
              // background-color: rgba($color: #000000, $alpha: 0);
              position: absolute;
              border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
              top:0;
              left:0;
              transition: 0.5s;
              z-index: 20;
              .del-btn {
                font-size: 0.875rem;
                line-height: 0.875rem;
                font-weight: 500;
                color: #FFFFFF;
                padding:0.5625rem 0.75rem;
                background: rgba(255,255,255,0.2);
                border-radius: 0.9375rem 0.9375rem 0.9375rem 0.9375rem;
                border: 0.0625rem solid #FFFFFF;
                display: inline-block;
              }
            }
          }
        }
      }
    }

    #foota {
      position: fixed;
      bottom: 0;
      background: #fff;
      width: 100%;
      display: flex;
      align-items: center;

      .el-checkbox {
        flex: 5;
        text-align: left;
        padding-left: 0.9375rem;
      }

      .dels {
        flex: 3;
        border-radius: 0.25rem;
        border: solid 0.0625rem red;
        background: red;
        color: #fff;
        padding: 0.625rem;
      }
    }

    .tbs {
      .van-swipe-cell {
        width: 100%;

        ::v-deep .van-swipe-cell__wrapper {
          display: flex;
          width: 100%;
          padding: 0.625rem 0.75rem;

          .van-button {
            height: 100%;
            width: 1rem;
            background: #f15353;
            line-height: 1.5rem;
            font-size: 16px;
          }

          .van-button--danger {
            border: none;
          }
        }
      }
    }
    .mh-56 {
      height: 56px;
      clear: both;
    }

    .footer-btn {
      width:23.4375rem;
      position: fixed;
      bottom: 0;
      left:0;
      padding:0.625rem 0.75rem 0.625rem 0.75rem;
      background-color: #fff;
      z-index: 25;
      .confrim-btn {
        font-size: 0.875rem;
        line-height: 0.875rem;
        font-weight: 400;
        color: #FFFFFF;
        padding:0.6875rem 1.75rem;
        border-radius: 1.875rem 1.875rem 1.875rem 1.875rem;
        background: #F15353;
      }
    }
    .hint {
      padding:0.625rem 0 0 0.75rem;
      width:23.4375rem;
      // position: fixed;
      bottom: 4.0625rem;
      left:0;
      text-align: center;
      z-index: 25;
      color: #666;
      font-size: 0.75rem;
      text-align: left;
    }
  }
</style>
